package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._02策略模式._5商品价格策略模式;

/**
 * @ClassName CashRebate
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/10 12:01 AM
 * @Version 1.0
 */
public class CashRebate extends CashSuper {
    private double moneyRebate = 1d;

    //打折收费。初始化时必需输入折扣率。八折就输入0.8
    public CashRebate(double moneyRebate) {
        this.moneyRebate = moneyRebate;
    }

    //计算收费时需要在原价基础上乘以折扣率
    @Override
    public double acceptCash(double price, int num) {
        return price * num * this.moneyRebate;
    }
}
